'use strict';

import Base from './base.js';

export default class extends Base {
	async articlelistAction(){
		return this.display();
	}

	async editorAction(){
		return this.display();
	}

	// 七牛上传
	async gettokenAction(){
		let qiniu = require('qiniu');
		//需要填写你的 Access Key 和 Secret Key
		qiniu.conf.ACCESS_KEY = 'YxHKR7OEpUjFbsAnXJ2M_82mNfqfWDdcDAm8XLPL';
		qiniu.conf.SECRET_KEY = 'X6icCWZyqXDcvPo2pPCU2nXunMDidbImVrOAmEtY';
		//要上传的空间
		let bucket = 'meiyitong'

		let mac = new qiniu.auth.digest.Mac(qiniu.conf.ACCESS_KEY, qiniu.conf.SECRET_KEY)
		let putPolicy = new qiniu.rs.PutPolicy({
		  scope: bucket,
		})
		let uploadToken = putPolicy.uploadToken(mac)

		let data = {'uptoken': uploadToken}
		return this.json(data)
	}
}